package cn.openea.perpartner.meily.web.controller;

import cn.openea.perpartner.common.core.web.controller.BaseController;
import cn.openea.perpartner.common.core.web.page.TableDataInfo;
import cn.openea.perpartner.meily.web.entity.Order;
import cn.openea.perpartner.meily.web.entity.vo.OrderSearchVo;
import cn.openea.perpartner.meily.web.service.IOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author rains
 * @since 2023-05-16 12:14
 */
@Api(tags = "订单")
@RestController
@RequestMapping("/order")
public class OrderController extends BaseController {

    @Resource
    private IOrderService orderService;

    @ApiOperation("获取我的订单列表")
    @PostMapping("/list")
    public TableDataInfo getOrderList(@RequestBody OrderSearchVo vo) {
        startPage();
        List<Order> list = this.orderService.getOrderListByOrderSys(vo);// 获取订单列表-订单系统
        TableDataInfo dataInfo = getDataTable(list);
        dataInfo.setRows(this.orderService.assemblyData(list));// 组装业务数据
        return dataInfo;
    }

}
